package cn.thoughtworks.school.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;


@FeignClient(name = "${feign.programCenter.name}",
  url = "${feign.programCenter.url}")
@Service
public interface ProgramCenterFeign {


  @PostMapping("api/programs/{programId}/{type}/{userId}")
  ResponseEntity joinProgram(@PathVariable("programId") Long programId,
                             @PathVariable("type") String type,
                             @PathVariable("userId") Long userId,
                             @RequestBody Map data);

  @GetMapping("api/programs/{programId}")
  ResponseEntity<Map> getProgram(@PathVariable("programId") Long programId);

  @GetMapping("api/programs/inviteLinks/{programId}")
  Map getProgramInviteLinks(@PathVariable("programId") Long programId);

}
